<!DOCTYPE html>
<html class="no-js" lang="">
<head>#include( "/public-head.html")</head>

<body style="background-color: #ffffff !important;">
	<div class="main-content checkbo">
		<div class="panel mb25">
			<div class="panel-heading border">修改歌曲</div>
			<div class="panel-body">
				<div class="row no-margin">
						<form action="/vrs/music/edit.jsn" data-url="/vrs/music/list.jsn" id="musicForm" name="ajaxForm"
							class="form-horizontal bordered-group" role="form">

							<div class="form-group">
								<label class="col-sm-2 control-label">歌曲id</label>
								<div class="col-sm-10">
									<input type="hidden" name="music.id" value="$!{music.id}">
									<input type="text"  class="form-control w100" value="$!{music.id}" placeholder="歌曲id" disabled="">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">名称<code>*</code></label>
								<div class="col-sm-10">
									<input type="text" required name="music.name" value="$!{music.name}" class="form-control w150" placeholder="名称">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">分类<code>*</code></label>
								<div class="col-sm-10">
									<select id="categorySelect" required data-placeholder="请选择分类" multiple class="chosen" name="music.categoryIds" style="width: 60%;">
										<option value=""></option>
										#if($categroyList)
										#foreach( $row in $!{categroyList})
										<option value="$!{row.categoryId}">$!{row.name}</option>
										#end
										#end
									</select>
								</div>
							</div>
							<div class="form-group">
	                            <label class="col-sm-2 control-label">所属专辑<code>*</code></label>
	                            <div class="col-sm-10">
	                                <select id="albumSelect" required data-placeholder="请选择专辑" class="chosen w150" name="music.albumId">
	                                    <option value=""></option>
	                                    #if($albumList)
	                                        #foreach( $row in $!{albumList})
	                                        <option value="$!{row.id}">$!{row.name}</option>
	                                        #end
	                                    #end
	                                </select>
	                            </div>
	                        </div>
							<div class="form-group">
	                            <label class="col-sm-2 control-label">艺人<code>*</code></label>
	                            <div class="col-sm-10">
	                                <select id="starrSelect" required data-placeholder="请选择艺人"  multiple class="chosen" name="music.starringIds">
	                                    <option value=""></option>
	                                    #if($starringList)
		                                    #foreach( $row in $!{starringList})
		                                    <option value="$!{row.starringId}">$!{row.name}</option>
		                                    #end
	                                    #end
	                                </select>
	                            <span style="color: #CDC5BF">*请先选择专辑</span>
	                            </div>
	                        </div>
	                        <!--<div class="form-group">
								<label class="col-sm-2 control-label">播放地址</label>
								<div class="col-sm-10">
									<input type="text" required name="music.url" value="$!{music.url}" class="form-control w250" placeholder="播放地址">
								</div>
							</div>-->
							<div class="form-group">
								<label class="col-sm-2 control-label">上传音频<code>*</code></label>
								<div class="col-sm-10">
									<div data-theme-name="upload-audio-text" class="btn btn-primary mr10 audio-text" >点击上传音频</div>
									<input id="audioFile" class="btn btn-primary mr10 audio-file" type="file" >
									<audio id="play" controls="controls" src="$!{music.url}" class=""/>
									<input name="url" value="$!{music.url}" class="hidden">
								</div>
							</div>
	                        <div class="form-group">
	                            <label class="col-sm-2 control-label">标签<code>*</code></label>
	                            <div class="col-sm-10">
	                                <input id="tag" type="text" required class="tags" name="music.tag"  value="$!{music.tag}" />
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label class="col-sm-2 control-label">是否上线<code>*</code></label>
	                            <div id="isDisplayRadio" class="col-sm-10">
	                                <label class="cb-radio">
	                                    <input type="radio" required name="music.isdisplay" value="1" />上线
	                                </label>
	                                <label class="cb-radio">
	                                    <input type="radio" required name="music.isdisplay" value="0" />下线
	                                </label>
	                            </div>
	                        </div>
							<div class="form-group">
								<label></label>
								<div>
									<button type="button" onclick="submitPerForm()" class="btn btn-primary mr10">保存</button>
									<button class="btn btn-default">返回</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>


	</div>
	<!-- /main area -->
	#include( "/public-script.html")
	#include( "/sub-script.html")
	<script src="/scripts/audio.js"></script>
	<script>
		//专辑
		initEditSelect('albumSelect','$!{music.albumId}');
		initEditSomeSelect('categorySelect','$!{music.categoryIds}');
		//艺人
		initMusicStarr($('#albumSelect'),'starrSelect','$!{music.starringIds}');
		//标签
		initEditInput('tags','$!{music.tag}')
		//是否上线
		initEditRadio('isDisplayRadio','$!{music.isdisplay}')	 
	
	
	
		$("#starrSelect").chosen({
	        search_contains:true
	    });
		$(function(){
//			$('#musicForm').validate();
			//选择专辑后
		    $('#albumSelect').change(function(){
		        var $this = $(this);
		        initMusicStarr($this,'starrSelect','$!{music.starringIds}');
		    });
	    });
		//提交
		function submitPerForm() {
			var $form = $('#musicForm');

			if (!$form.valid()) {
				checkForm($form);
				return false;
			} else {
				$('#musicForm').submit();
			}
		}
		
	</script>
</body>

</html>
